package com.wel.onlineshopping.repository;

import com.wel.onlineshopping.model.Cart;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Optional;

public interface CartRepository extends JpaRepository<Cart, Long> {

    @Query("SELECT c FROM Cart c WHERE c.product.id = :productId")
    Optional<Cart> findByProductId(@Param("productId") Long productId);
}
